--天坠之火
local tianzhuizhihuo = fk.CreateSkill {
    name = "mcdh_tianzhuizhihuo"
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

tianzhuizhihuo:addEffect('active',{
    can_use = function(self, player)
        return player:usedSkillTimes(self.name,Player.HistoryPhase) == 0 and player:getMark("mcdh_charge") >= 5
    end,
    target_filter = function(self,player, to_select, selected)
        return #selected == 0 and to_select ~= player
    end,
    card_filter = function(self,player, to_select, selected)
        return #selected < 3
    end,
    feasible = function(self,player, targets, cards)
        return #cards >= 2 and #cards <= 3 and #targets == 1
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        local to = effect.tos[1]
        lib.LoseCharge(player,player,5,self.name)
        local suits = {}
        for _, id in ipairs(effect.cards) do
            table.insertIfNeed(suits,Fk:getCardById(id):getSuitString())
        end
        room:throwCard(effect.cards, self.name, player, player)
        if #room:askForDiscard(to,4-#effect.cards,4-#effect.cards,true,self.name,true,".|.|^("..table.concat(suits,",")..")","#mcdh_tianzhuizhihuo:"..player.id.."::"..4-#effect.cards) == 0 then
            room:damage{
                from = player,
                to = to,
                damage = 2,
                damageType = fk.FireDamage,
                skillName = self.name,
            }
        end

    end
})

Fk:loadTranslationTable {
    ["mcdh_tianzhuizhihuo"] = "天坠之火",
    [":mcdh_tianzhuizhihuo"] = "蓄力技(5)，出牌阶段，你可以弃置两至三张牌，并令一名其他角色选择一项：1.弃置 4-X 张与这些弃置牌花色均不同的牌（X为你弃置牌数）；2.受到由你造成的2点火焰伤害。",
    ["#mcdh_tianzhuizhihuo"] = "天坠之火:弃置 %arg 张与 %src 弃置牌花色均不同的牌，否则受到其造成的2点火焰伤害"
}

return tianzhuizhihuo